//下面是模板库
import request from '@/utils/request'
//新增模板类型
export function taskList(query) {
  return request({
    url: '/system/task/list',
    method: 'get',
    params: query
  })
}
export function taskInsert(query) {
  return request({
    url: '/system/task/insert',
    method: 'post',
    data: query
  })
}
export function batchDelete(query) {
  return request({
    url: '/system/task/batchDelete',
    method: 'post',
    data: query
  })
}
export function update(query) {
  return request({
    url: '/system/task/update',
    method: 'post',
    data: query
  })
}
export function getDetails(query) {
  return request({
    url: '/system/task/' + query,
    method: 'get',
  })
}

// 查询模板详情详细
export function getTemplates(query) {
  return request({
    url: '/system/task/material/' + query.templateId,
    method: 'get',
    // params: query
  })
}
// 保存素材到模板
export function saveMaterial(query) {
  return request({
    url: '/system/task/save/material',
    method: 'post',
    data: query
  })
}
export function saveWord(query) {
  return request({
    url: '/system/template/word',
    method: 'post',
    data: query,
    responseType: "blob"
  })
}
// 查询模板详情详细
export function getTemplatesInfo(query) {
  return request({
    url: '/system/template/' + query.templateId,
    method: 'get',
    // params: query
  })
}
export function saveNewtemplate(query) {
  return request({
    url: '/system/task/new/template',
    method: 'post',
    data: query
  })
}
export function myList(query) {
  return request({
    url: '/system/task/my/list',
    method: 'get',
    params: query
  })
}
export function myCreate(query) {
  return request({
    url: '/system/task/my/create',
    method: 'get',
    params: query
  })
}

// 获取我的待办任务数量
export function myUnreadNum(query) {
  return request({
    url: '/system/task/my/unreadNum',
    method: 'get',
    params: query
  })
}

// base64转换为http
export function baseUpload(data) {
  return request({
    url: '/common/base64/upload',
    method: 'post',
    data
  })
}